//
//  YGScienceLowerTableViewCell.m
//  yuanshangyiliao
//
//  Created by icholab on 2021/4/29.
//

#import "YGScienceLowerTableViewCell.h"

@interface YGScienceLowerTableViewCell ()

@property (nonatomic, strong) UILabel *titleLabel;
@property (nonatomic, strong) UILabel *dateLabel;
@property (nonatomic, strong) UIView *lineView;

@property (nonatomic, strong) UIImageView *articleImgView;




@end

@implementation YGScienceLowerTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self initView];
        [self initconstrains];
    }
    return self;
}

-(void)initView{
    [self addSubview:self.titleLabel];
    [self addSubview:self.dateLabel];
    [self addSubview:self.lineView];
    [self addSubview:self.articleImgView];
}

-(void)initconstrains{
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.mas_equalTo(self.mas_top).offset(15);
            make.left.mas_equalTo(self.mas_left).offset(10);
            make.width.mas_equalTo(240);
            make.height.mas_equalTo(50);
    }];
    
    [self.dateLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.mas_equalTo(self.titleLabel.mas_bottom).offset(10);
            make.left.mas_equalTo(self.titleLabel.mas_left);
            make.width.mas_equalTo(100);
            make.height.mas_equalTo(12);
    }];
    
    [self.lineView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.bottom.mas_equalTo(self.mas_bottom);
            make.width.mas_equalTo(240);
            make.left.mas_equalTo(self.titleLabel.mas_left);
            make.height.mas_equalTo(1);
    }];
    
    [self.articleImgView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.mas_equalTo(self.mas_centerY);
            make.right.mas_equalTo(self.mas_right).offset(10);
            make.width.mas_equalTo(100);
            make.height.mas_equalTo(100);
    }];
}

#pragma setter
- (UILabel *)titleLabel{
    if (!_titleLabel) {
        _titleLabel = [[UILabel alloc]init];
        _titleLabel.textColor = UIColorFromRGB(0x333333);
        _titleLabel.font = [UIFont systemFontOfSize:12];
        _titleLabel.numberOfLines = 0;
    }
    return _titleLabel;
}

- (UILabel *)dateLabel{
    if (!_dateLabel) {
        _dateLabel = [[UILabel alloc]init];
        _dateLabel.textColor = UIColorFromRGB(0x999999);
        _dateLabel.font = [UIFont systemFontOfSize:12];
    }
    return _dateLabel;
}

- (UIView *)lineView{
    if (!_lineView) {
        _lineView = [[UIView alloc]init];
        _lineView.backgroundColor = UIColorFromRGB(0x999999);
    }
    return _lineView;
}

- (UIImageView *)articleImgView{
    if (!_articleImgView) {
        _articleImgView = [[UIImageView alloc]init];
        
    }
    return _articleImgView;
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
